package com.shujia.day14;

import java.util.HashMap;

/*
    HashMap<Student3,String>

    Map的唯一性指的是键的唯一性，HashMap中需要键的类型要重写hashCode()方法和equals方法

 */
public class HashMapDemo1 {
    public static void main(String[] args) {
        HashMap<Student3, String> map1 = new HashMap<>();

        Student3 s1 = new Student3("李刚", 21);
        Student3 s2 = new Student3("钱志强", 22);
        Student3 s3 = new Student3("江川", 21);
        Student3 s4 = new Student3("李刚", 21);
        Student3 s5 = new Student3("吴问强", 23);

        map1.put(s1, "打羽毛球");
        map1.put(s2, "唱");
        map1.put(s3, "跳");
        map1.put(s4, "看美女");
        map1.put(s5, "打游戏");

        System.out.println("map1: " + map1);


    }
}
